<?php

namespace app\api\controller;

use app\api\service\CourseService;
use app\common\controller\Api;

/**
 * Notes:课程接口
 * DateTime 2022/3/22 10:13
 * @Author wind
 * Class Course
 * @package app\api\controller
 */
class Course extends Api
{
    protected $noNeedLogin = '*';
    protected $noNeedRight = '*';

    /**
     * @var $service CourseService
     */
    protected $service = null;

    public function _initialize()
    {
        parent::_initialize();
        $this->service = new CourseService();
    }

    public function lists()
    {
        $param = request()->param();
        $this->validate($param, get_class(), 'lists');
        $this->serviceResponse($this->service->lists($param));
    }

    /**
     * Notes:课程详情
     * DateTime 2022/3/22 10:59
     * @Author wind
     */
    public function detail()
    {
        $param = request()->param();
        $this->validate($param, get_class(), 'detail');
        $this->serviceResponse($this->service->detail($param));
    }

    /**
     * Notes:专栏课程表
     * DateTime 2022/3/29 11:28
     * @Author wind
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function packagelist()
    {
        $param = request()->param();
        $this->validate($param, get_class(), 'packagelist');
        $this->serviceResponse($this->service->packagelist($param));
    }
}